package com.ysm.smfu.holder;

import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

import com.ysm.smfu.R;
import com.ysm.smfu.bean.Bonus;
import com.ysm.smfu.utils.UIUtils;

/**
 * Created by Administrator on 2016/11/16.
 */
public class BonusHolder extends BaseHolder<Bonus.Bonu> {

    private TextView name;
    private TextView nameV;
    private TextView type;
    private TextView time;
    private TextView count;

    @Override
    protected View initView() {
        View view = UIUtils.inflate(R.layout.holder_bonusdetail);
        name = (TextView) view.findViewById(R.id.name);
        nameV = (TextView) view.findViewById(R.id.nameV);
        type = (TextView) view.findViewById(R.id.type);
        time = (TextView) view.findViewById(R.id.time);
        count = (TextView) view.findViewById(R.id.count);
        return view;
    }

    @Override
    protected void refreshView(Bonus.Bonu data) {
        name.setText(data.title);
        nameV.setText(TextUtils.equals(data.friend_level, "1") ? "一级好友" : TextUtils.equals(data.friend_level, "2") ?
                "二级好友" : TextUtils.equals(data.friend_level, "3") ? "三级好友" : TextUtils.equals(data.friend_level, "4") ? "四级好友" : "");
        nameV.setVisibility(TextUtils.equals(data.friend_level, "0") ? View.GONE : View.VISIBLE);
        nameV.setVisibility(TextUtils.isEmpty(data.friend_level) ? View.GONE : View.VISIBLE);
        type.setText(TextUtils.equals(data.type, "01") ? "省级代理佣金" : TextUtils.equals(data.type, "02") ? "区县代理佣金" : TextUtils.equals(data.type, "03") ? "对接人佣金" :
                TextUtils.equals(data.type, "04") ? "一级佣金" : TextUtils.equals(data.type, "05") ? "二级佣金" : TextUtils.equals(data.type, "06") ? "实体店佣金" : "");
        time.setText(data.create_time);
        count.setText("￥" + data.bonus);
    }
}
